#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
#TODO: documentation!
"""

__version__ = '$Id$'


class ViewManager(object):

    def __init__(self):
        self._view_groups = []
        self._current_group = []

    def add_view(self, view):
        if view not in self._current_group:
            self._current_group.append(view)
    def add_views(self, views):
        for view in views:
            self.add_view(view)
            
    def remove_view(self, view):
        if view in self._current_group:
            self._current_view.remove(view)
    def remove_views(self, views):
        for view in views:
            self.remove_view(view)

    def push_views(self, views):
        if self._current_group:
            self._view_groups.append(self._current_group)
        self._current_group = views

    def pop_views(self):
        if self._view_groups:
            self._current_group = self._view_groups.pop()
        else:
            self._current_group = None

    def get_views(self):
        return self._current_group